

/* This do file provides the code for all the tables in Appendix 2 (except for tables A2.7 and A2.12)
, Appendix 5, and Appendix 6. */

global dataDir "D:\swweschl\Dropbox\Party_Interactions_Perceptions\PSRM Submission\Replication Files"
use "$dataDir/replication_data.dta", clear


/* Tables A2.1 */

set more off


foreach policy in mf_df_rile1 lrdist{

foreach cabpar in current_bothCab perceived_bothCab percent_month120_bothCab{

mixed coop coopscore_meanfull_withzero ///
				 `policy' ///
				 `cabpar'  ///
				  , ||_all:R.groupdyad || respid:	

}
}


/* Table A2.2 */



/* create a variable where we replace missing value of the events score with 
the average score */

capture drop coopscore_meanfull_avg
gen coopscore_meanfull_avg=coopscore_meanfull

levelsof countryyear, local(levels) 
foreach l of local levels {

sum coopscore_meanfull if countryyear==`l'

replace coopscore_meanfull_avg=r(mean) if coopscore_meanfull_avg==. & countryyear==`l'


}

set more off
foreach policy in mf_df_rile1 lrdist{

foreach cabpar in current_bothCab perceived_bothCab percent_month120_bothCab{

mixed coop coopscore_meanfull_avg ///
				 `policy' ///
				 `cabpar'  ///
				  , ||_all:R.groupdyad || respid:	

}
}


/* Table A2.3 */

set more off


foreach policy in mf_df_rile1 lrdist{

foreach cabpar in current_bothCab perceived_bothCab percent_month120_bothCab{

eststo: mixed coop coopscore_meanhalf ///
				 `policy' ///
				 `cabpar'  ///
				  , ||_all:R.groupdyad || respid:	

}
}
/* Table A2.4 */


set more off


foreach policy in mf_df_rile1 lrdist{

foreach cabpar in current_bothCab perceived_bothCab percent_month120_bothCab{

mixed coop coopscore_meanhalf_withzero ///
				 `policy' ///
				 `cabpar'  ///
				  , ||_all:R.groupdyad || respid:	

}
}

/* Table A2.5 */


set more off


foreach policy in mf_df_rile1 lrdist{

foreach cabpar in percent_month240_bothCab percent_month360_bothCab{

mixed coop coopscore_meanfull ///
				 `policy' ///
				 `cabpar'  ///
				  , ||_all:R.groupdyad || respid:	

}
}

/* Table A2.6 */

set more off
foreach policy in mf_df_rile1 lrdist{

foreach cabpar in current_bothCab_v2 perceived_bothCab_v2 ///
 percent_month120_bothCab_v2{

mixed coop coopscore_meanfull ///
				 `policy' ///
				 `cabpar'  ///
				  , ||_all:R.groupdyad || respid:	

}
}

/* Table A2.8 */

/* create group based on habitual news reception where
1=low, 2=medium, 3=high */

capture drop pk_group
gen pk_group=1 if sumpk<3 & (countryyear==1|countryyear==2)
replace pk_group=2 if (sumpk==3|sumpk==4) & (countryyear==1|countryyear==2)
replace pk_group=3 if sumpk>4  & (countryyear==1|countryyear==2)

replace pk_group=1 if sumpk<4 & countryyear==3
replace pk_group=2 if sumpk==4 & countryyear==3
replace pk_group=3 if sumpk>4 & countryyear==3

replace pk_group=1 if sumpk<2 & countryyear==4
replace pk_group=2 if (sumpk==2|sumpk==3) & countryyear==4
replace pk_group=3 if sumpk>3 & countryyear==4

replace pk_group=1 if sumpk<3 & countryyear==5
replace pk_group=2 if (sumpk==3|sumpk==4) & countryyear==5
replace pk_group=3 if sumpk>4 & countryyear==5

replace pk_group=1 if sumpk<3 & countryyear==6
replace pk_group=2 if (sumpk==3|sumpk==4) & countryyear==6
replace pk_group=3 if sumpk>4 & countryyear==6

replace pk_group=1 if sumpk<2 & countryyear==7
replace pk_group=2 if (sumpk==2|sumpk==3) & countryyear==7
replace pk_group=3 if sumpk>3 & countryyear==7

set more off

foreach policy in mf_df_rile1 lrdist{

foreach cabpar in current_bothCab perceived_bothCab ///
 percent_month120_bothCab{

mixed coop c.coopscore_meanfull_withzero##pk_group ///
				 `policy' ///
				 `cabpar'  ///
				  , ||_all:R.groupdyad || respid:	

}
}

/* Table A2.9 */

set more off

foreach policy in mf_df_rile1 lrdist{

foreach cabpar in current_bothCab perceived_bothCab ///
 percent_month120_bothCab{

mixed coop c.coopscore_meanfull_avg##pk_group ///
				 `policy' ///
				 `cabpar'  ///
				  , ||_all:R.groupdyad || respid:	

}
}


/* Table A2.10 */

set more off

foreach policy in mf_df_rile1 lrdist{

foreach cabpar in current_bothCab perceived_bothCab ///
 percent_month120_bothCab{

mixed coop c.coopscore_meanhalf##pk_group ///
				 `policy' ///
				 `cabpar'  ///
				  , ||_all:R.groupdyad || respid:	

}
}

/* Table A2.11 */

set more off

foreach policy in mf_df_rile1 lrdist{

foreach cabpar in current_bothCab perceived_bothCab ///
 percent_month120_bothCab{

mixed coop c.coopscore_meanhalf_withzero##pk_group ///
				 `policy' ///
				 `cabpar'  ///
				  , ||_all:R.groupdyad || respid:	

}
}


/* Table A5.1 */

set more off

foreach policy in mf_df_rile1 lrdist{

foreach cabpar in current_bothCab perceived_bothCab ///
 percent_month120_bothCab{

mixed coop c.coopscore_meanfull_withzero ///
				 c.`policy'##i.pk_group ///
				 `cabpar'  ///
				  , ||_all:R.groupdyad || respid:	

}
}


/* Table A5.2 */



set more off

foreach policy in mf_df_rile1 lrdist{

foreach cabpar in current_bothCab perceived_bothCab ///
 percent_month120_bothCab{

mixed coop c.coopscore_meanfull_withzero ///
				 c.`policy' ///
				 c.`cabpar'##i.pk_group  ///
				  , ||_all:R.groupdyad || respid:	

}
}

/* Table A6.2 */

/* create group based only onthe number of correct answers to the current event questions */



capture drop sumCEcorrect
egen sumCEcorrect=rowtotal(pk4correct pk5correct pk6correct)

capture drop ce_group
gen ce_group=1 if sumCEcorrect<2
replace ce_group=2 if sumCEcorrect==2
replace ce_group=3 if sumCEcorrect==3

set more off
foreach policy in mf_df_rile1 lrdist{

foreach cabpar in current_bothCab perceived_bothCab ///
 percent_month120_bothCab{

 mixed coop c.coopscore_meanfull##i.ce_group ///
				 `policy' ///
				 `cabpar'  ///
				  , ||_all:R.groupdyad || respid:	

}
}


